<script src="/javascripts/util.js" type="text/javascript"></script>
<script src="/javascripts/calendar.js" type="text/javascript"></script>
<script type="text/javascript">
    function checkDate(){
        frmSalePaper.submit();
    }
function showAgentWindow(id)
        {
                window.open("/other_org/agent_info/"+id,"_blank","height=450,width=550,top=300,left=400,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
        }
function showProductWindow(id)
{
    window.open("/product/product_info/"+id,"_blank","height=500,width=750,top=300,left=400,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}
function showPaperWindow(id)
{
    window.open("/sale/show_print_sale_paper/"+id,"_blank","height=450,width=700,top=300,left=400,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}

</script>
<h1>报表中心 - <span id="secondHeading">退货记录</span></h1>
<form id="input-form" name="frmSalePaper" action="/query/return_recorde" method="post">
<div style="margin-left:70px;">
    <input type="hidden" name="type" value="<%=@type%>"/>
	品名规格&nbsp;<input type="text" name="serial" maxlength="20">&nbsp;&nbsp;导针规格&nbsp;&nbsp;<input type="text" name="name" maxlength="20"><br/>
        起始时间
        <script language=javascript>
        var beignDate=new dateSelector();
        beignDate.inputID='beginDate';
        beignDate.inputName='from';
        beignDate.display();
        </script>
        <br/>结束时间        
        <script language=javascript>
        var endDate=new dateSelector();
        endDate.inputID='endDate';
        endDate.inputName='to';
        endDate.display();
        </script>
        　　　　　
        <input  type="button" value="查询" class="sub" onclick="checkDate()">
	<input type="hidden" name="papertype" value="<%=@type%>"/>
</div>
</form>
<div>
        <% if @flash[:notice] -%>
                <div id="notice"><%= @flash[:notice] %></div>
        <% end -%>
</div>
<%if @return_paper_items%>
</p>
<TABLE border="0" id="LIST_TB">
	<TR id="LIST_TB_TITLE">
	    <TD colspan="2">产品名</TD>
	    <TD>客户</TD>
            <TD>订单号</TD>
<TD>发货单号</TD>
		<TD>销售时间</TD>
		<TD>退货时间</TD>
		<TD>退货数量（kpcs）</TD>
		<TD>退货理由</TD>
	</TR>
	<%@return_paper_items.each do |item|%>
	<TR id="LIST_TB_CONTENT1">
                <TD><a href="javascript:showProductWindow(<%=item.product.id%>)"><%=item.product.serial%></a></TD>
		<TD><a href="javascript:showProductWindow(<%=item.product.id%>)"><%=item.product.name%></a></TD>
		<TD><%=item.salePaper.agent.name%></TD>
                <TD><a href="javascript:showPaperWindow(<%=item.sale_paper_id%>)"><%=item.sale_paper_id%></a></TD>
	<TD><%=item.serial%></TD>
		<TD><%=item.salePaper.sale_date_at%></TD>
		<TD><%=item.create_date_at%></TD>
		<TD><%=item.current_count%></TD>
		<TD><%=item.memo%></TD>
	</TR>
	<%end%>
</TABLE>
<%end%>
<table>
        <tr>
                <td>
                        <input type="button" value="打印当前页" class="sub" onclick="openPrintWindow('LIST_TB')"/>
                        <input type="button" value="导出当前数据" class="sub" onclick="CellAreaExcel('LIST_TB')"/>
                </td>
                <td>
                        <div class="pagination">
                        <ul>
                                <li class="btn">
                                <%if @return_paper_item_pages.current.previous%>
                                <%=link_to("<<上一页", { :page => @return_paper_item_pages.current.previous })%>
                                <%else%>
                                <span>&lt;&lt;上一页</span>
                                <%end%>
                        </li>
                        <li><%= pagination_links(@return_paper_item_pages) if @return_paper_item_pages%></li>
                                <li class="btn">
                                <%if @return_paper_item_pages.current.next%>
                                <%=link_to("下一页>>", { :page => @return_paper_item_pages.current.next })%>
                                <%else%>
                                <span>下一页&gt;&gt;</span>
                                <%end%>
                        <li>
                        </ul>
                        </div>
                </td>
        </tr>
</table>
